<template>
  <div class="app-container">
    <!-- <page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick"
      @reset-click="handleResetClick" /> -->
    <PageContent ref="contentRef" :content-config="contentConfig" @addClick="handleAddClick"
      @edit-click="handleEditClick" @export-click="handleExportClick" @toolbarClick="handleToolbarClick"
      @operat-click="handleOperatClick">
      <template #type="scope">
        <el-tag :type="statusList[scope.row[scope.prop]].type || ''">
          {{$t(statusList[scope.row[scope.prop]].text) }}
        </el-tag>
      </template>
    </PageContent>
  </div>
</template>

<script setup>
import Api from '@/api/finance/transfer'
import contentConfig from "./config/content";
import searchConfig from "./config/search";
import usePage from "@/hooks/usePage";
import { onMounted } from "vue";
defineOptions({
  name: "clientTiers",
  inheritAttrs: false,
});
const { t } = useI18n();
const statusList = {
  'transfer_in': { text: t("status.25"), type: "success" },
  'transfer_out': { text: t("status.26"), type: "danger" },
}
const { searchRef, contentRef, addModalRef, editModalRef,
  handleQueryClick, handleResetClick, handleAddClick,
  handleSubmitClick, handleExportClick, } = usePage();
const handleEditClick = (row) => {
  // 模拟根据id获取数据进行填充
  editModalRef.value?.setModalVisible(row);
}
const handleOperatClick = ({ name, column, row }) => {
  console.log('handleOperatClick', name, column, row);
  if (name === 'note') {
    ElMessageBox.prompt(t('hint.71'), t('hint.1'), {
      inputPattern: /\S/,
      inputErrorMessage: t('hint.71'),
      inputPlaceholder: row.note
    }).then(({ value }) => {
      console.log(value);
      Api.put({ id: row.id, note: value }).then(s => {
        handleQueryClick()
      })

    })
  }
}
onMounted(() => {
})
</script>

<style></style>